//
//  CAIBehaviorWaitCommand.cpp
//  Monster_Martial_Arts_Version_0
//
//  Created by chiawei.tseng on 13/1/16.
//
//

#include "CAIBehaviorWaitCommand.h"
#include "CBattleObject.h"
#include "BattleDef.h"
#include "cocos2d.h"

using namespace cocos2d;

CAIBehaviorWaitCommand::CAIBehaviorWaitCommand():CAIBehavior()
{
    m_nCurrProcess = INVALID;
}

CAIBehaviorWaitCommand::~CAIBehaviorWaitCommand()
{
    
}

bool CAIBehaviorWaitCommand::Init(CAIManager* ptr)
{
    if (ptr)
    {
        m_AiManager = ptr;
        
        Register(WaitCommand,&CAIBehaviorWaitCommand::onProcessWaitCommand);
        
        return true;
    }
    
    return false;
}

void CAIBehaviorWaitCommand::Entering(IStateInput*)
{
    /*
    if (CheckMasterIsEnterLayer())
    {
        m_ShouldExit = true;
        
        m_AiBrhaviorID = AI_BEHAVIOR_ENTER_BATTLE_LAYER;
    }
    else
    {
        
    }
    */
    
    MyMaster()->ChangeActiveAnimation(ACTIVE_ANIMATION_ID_IDLE);
    
    m_nCurrProcess = WaitCommand;
}

void CAIBehaviorWaitCommand::Update(IStateInput*)
{
    this->processFun(m_nCurrProcess);
}

void CAIBehaviorWaitCommand::Leaving(IStateInput*)
{
    
}

int CAIBehaviorWaitCommand::ShouldChange(IStateInput*)
{
    /*
    if (m_ShouldExit)
    {
        return m_AiBrhaviorID;
    }
    */
    return INVALID;
}


void CAIBehaviorWaitCommand::onProcessWaitCommand()
{
    
}

/*
bool CAIBehaviorWaitCommand::CheckMasterIsEnterLayer()
{
    CCSize size = CCDirector::sharedDirector()->getWinSize();
    
    if (MyMaster()->GetPoint().X >= size.width)
    {
        return false;
    }
    else if(MyMaster()->GetPoint().X <= 0)
    {
        return false;
    }
    
    return true;
}
*/



